<?php
/**
 * Pipahr
 * @brief An action to creat a new notify tpl
 *
 * @author Randy Zhao
 * @copyright 2013 pipahr.com
 */
OCP\JSON::checkAppEnabled('calendar');

if( !OC_User::isLoggedIn() ) {
   jexit(jsonError('您需要先登录', null, false));
}
if ( !PSession::checkToken('post') ) {
   jexit(jsonError('验证已失效，请重新验证', null, false));
}

$tpl_model = new PCalendarModelTpl();

$notify_id = $tpl_model->addNotifyTpl();

if ( !$notify_id ) {
   jexit(jsonError($tpl_model->getError(), null, false));
}

jexit(jsonSuccess(array('notify_id'=>$notify_id), null, null, false));